<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <p>{{msg}}</p>
        <!-- ref 为某个元素注册一个唯一标识，可以通过this.$refs.标识获取到对应的DOM元素 -->
        <div ref="thankyou">他会感谢你的</div>
        <div id="box1"></div>
        <button @click="btn">test ref</button>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        let vm = new Vue({
            el:'.box',
            data:{
                msg:'精神精神！！'
            },
            methods: {
                btn(){
                    console.log(this.$refs.thankyou.innerHTML);
                    /* 
                    innerHTML
                    innerText
                    textContent
                    获取元素的内容
                    */
                    //    
                    console.log(document.getElementById('box1'));
                }
            },
        })
    </script>
</body>
</html>